<?php
$loginIdStr = Yii::t('BWeSport', 'Login Id');
$userNameStr = Yii::t('BWeSport', 'User Name');
$emailStr = Yii::t('BWeSport', 'Email');
$mobileStr = Yii::t('BWeSport', 'mobile');
$personInfoStr = Yii::t('BWeSport', 'person info');
$modifyInfoStr = Yii::t('BWeSport', 'modify info');
$changePasswordStr = Yii::t('BWeSport', 'change password');
$applyMemberStr = Yii::t('BWeSport', 'apply Member');
$myCardNumStr = Yii::t('BWeSport', 'my card num');
?>
<?php
/*
 * this function will show user's info:
 * 1)user loginId
 * 2)user email
 * 3)user other info
 */
$user = Blyn::app()->getCurrentUser();
$userInfo = $user->getAttribute('userInfo');
$attributes = array();
if ($userInfo) {
    $attributes = $userInfo->getChildren();
}
?>
<style>
    @media (min-width: 768px){
        .displayUserInfo {
            margin-right: 0;
            margin-left: 0;
            background-color: #fff;
            border-color: #ddd;
            border-width: 1px;
            border-radius: 4px 4px 0 0;
            -webkit-box-shadow: none;
            box-shadow: none;
        }
    }
</style>
<div class="container">
    <h3 class="form-signin-heading text-muted"><?php echo $personInfoStr;?></h3>
    <div class="displayUserInfo">
        <table class="table table-striped">
            <thead>
                <tr>
                    <th></th>
                    <th></th>
                </tr>
            </thead>
            <tbody>
                <tr>
                    <td><?php echo $myCardNumStr.':';?></td>
                    <td><?php echo $user->getId(); ?></td>
                </tr>
                <tr>
                    <td><?php echo $loginIdStr.':';?></td>
                    <td><?php echo $user->userId; ?></td>
                </tr>
                <tr>
                    <td><?php echo $userNameStr.':';?></td>
                    <td><?php echo $user->userName; ?></td>
                </tr>
                <tr>
                    <td><?php echo $emailStr.':';?></td>
                    <td><?php echo $user->email; ?></td>
                </tr>
                <?php foreach ($attributes as $attr) { ?>
                    <tr>
                        <td><?php  if($attr->getName() == 'mobile') echo $mobileStr.':'; ?></td>
                        <td><?php echo $attr->getValue(); ?></td>
                    </tr>
                <?php } ?>

            </tbody>
        </table>
    </div>
    <div class="displayUserInfo">
        <?php
        echo $control->getAjaxLink(array('name' =>$modifyInfoStr, 'id' => BUIUser::Render_Modify_UserInfo), array('htmlOptions' => array(
                'class' => 'btn btn-success btn-lg btn-block'
        )));
        ?>
        <?php
        echo $control->getAjaxLink(array('name' => $changePasswordStr, 'id' => BUIUser::Render_Change_UserPassword), array('htmlOptions' => array(
                'class' => 'btn btn-info btn-lg btn-block'
        )));
        ?>
        <?php
        echo $control->getAjaxLink(array('name' => '会员资格', 'id' => BUIMembership::Show_User_Membership), array('htmlOptions' => array(
                'class' => 'btn btn-warning btn-lg btn-block'
        )));
        ?>
    </div>
</div>